﻿<%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
    CodeBehind="Default.aspx.cs" Inherits="compshop.web._Default" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
</asp:Content>

<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
    <asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
    </asp:ToolkitScriptManager>
    <div class="mainContent">

        <div class="navigation">
            <%--style="margin: 3px; background-color: #E9ECED; color: #333333;">--%>
            <asp:UpdatePanel ID="upCategories" runat="server">
                <ContentTemplate>
                    <asp:TreeView ID="tvCategories" runat="server" OnSelectedNodeChanged="tvCategories_SelectedNodeChanged"
                        NodeIndent="10" ForeColor="#3C3243">
                    </asp:TreeView>
                </ContentTemplate>
            </asp:UpdatePanel>
        </div>

        <asp:UpdatePanel ID="upProducts" runat="server">
            <ContentTemplate>

                <div class="goods">
                    <asp:ListView ID="lvProducts" runat="server" DataSourceID="odsProducts" OnItemCommand="lvProducts_ItemCommand">
                        <EmptyDataTemplate>
                            <span>Выбранная категория не содержит товаров</span>
                        </EmptyDataTemplate>

                        <ItemTemplate>
                            <div style="margin: 3px; background-color: #F3FFE6; color: #333333;">
                                <asp:Table ID="Table1" runat="server" CellPadding="15">
                                    <asp:TableRow>

                                        <asp:TableCell>
                                            <asp:Image Width="100" Height="100" AlternateText="Image" ID="PhotoLabel" runat="server"
                                                ImageUrl='<%# "~/ImageHandler.ashx?id=" + Eval("GeneralProductID") %>' />
                                        </asp:TableCell>

                                        <asp:TableCell>
                                            <asp:Panel runat="server">
                                                Модель:
                                                <asp:Label ID="NameLabel" runat="server" Text='<%# Eval("Name") %>' />
                                                <br />
                                                Производитель:
                                                <asp:Label ID="ProducerIDLabel" runat="server" Text='<%# Eval("Producer.Name") %>' />
                                                <br />
                                                Страна:
                                                <asp:Label ID="CountryIDLabel" runat="server" Text='<%# Eval("Country.Name") %>' />
                                                <br />
                                                Дополнительная информация:
                                                <asp:Label ID="InfoLabel" runat="server" Text='<%# Eval("Info") %>' />
                                            </asp:Panel>
                                        </asp:TableCell>

                                    </asp:TableRow>
                                </asp:Table>
                                <br />
                                <asp:Panel ID="panelCommand" runat="server" HorizontalAlign="right">
                                    Цена:
                                    <asp:Label ID="CurrentPriceLabel" runat="server" Text='<%# Eval("CurrentPrice", "{0:F2}") %>'
                                        Font-Bold="true" />
                                    <asp:Button ID="btnAddToBasket" runat="server" CommandName='<%# AddToBasketCommandName %>'
                                        CommandArgument='<%# Eval("GeneralProductID") %>' Text="В корзину" />
                                    <asp:Button ID="btnShowParameters" runat="server" CommandName='<%# ShowParametersCommandName %>'
                                        CommandArgument='<%# Eval("GeneralProductID") %>' Text="Параметры" />
                                </asp:Panel>
                                <br />
                                <br />
                            </div>
                        </ItemTemplate>

                        <LayoutTemplate>
                            <div id="itemPlaceholderContainer" runat="server" style="font-family: Verdana, Arial, Helvetica, sans-serif;">
                                <span runat="server" id="itemPlaceholder" />
                            </div>
                            <div style="text-align: center; background-color: #5D7B9D; font-family: Verdana, Arial, Helvetica, sans-serif;
                                color: #FFFFFF;">
                                <asp:DataPager ID="DataPager1" runat="server" PageSize="3">
                                    <Fields>
                                        <asp:NextPreviousPagerField ButtonType="Button" ShowFirstPageButton="True" ShowNextPageButton="False"
                                            ShowPreviousPageButton="False" />
                                        <asp:NumericPagerField />
                                        <asp:NextPreviousPagerField ButtonType="Button" ShowLastPageButton="True" ShowNextPageButton="False"
                                            ShowPreviousPageButton="False" />
                                    </Fields>
                                </asp:DataPager>
                            </div>
                        </LayoutTemplate>

                    </asp:ListView>


                    <asp:ObjectDataSource ID="odsProducts" runat="server" SelectMethod="GetGeneralProduct"
                        TypeName="compshop.web.ObjectDataSource">
                        <SelectParameters>
                            <asp:Parameter DefaultValue="-1" Name="category" Type="Int32" />
                            <asp:Parameter DefaultValue="-1" Name="subCategory" Type="Int32" />
                            <asp:Parameter DefaultValue="-1" Name="producer" Type="Int32" />
                        </SelectParameters>
                    </asp:ObjectDataSource>
                </div>

                <div class="shoppingBasket">
                    <p align="center">
                        <asp:ImageButton ID="btnBasket" runat="server" Height="130px" ImageUrl="~/images/carempty.png"
                            Style="margin-left: 0px" Width="130px" OnClick="btnBasket_Click" />
                        &nbsp;Корзина</p>
                    <p>
                        Количество товаров:
                        <asp:Label ID="lblProductsCount" runat="server"> </asp:Label></p>
                    <p>
                        На сумму:
                        <asp:Label ID="lblSum" runat="server"></asp:Label>
                        &nbsp;грн</p>
                    <p>
                        <asp:Button ID="btnClearBasket" runat="server" Text="Очистить корзину" OnClick="btnClearBasket_Click"
                            Width="130px" /></p>
                    <p>
                        <asp:Button ID="btnConfirmOrder" runat="server" Text="Оформить заказ" OnClick="btnConfirmOrder_Click"
                            Width="130px" /></p>
                    <p id="pFull" runat="server" visible="false" style="color: Red" />
                </div>

            </ContentTemplate>
        </asp:UpdatePanel>
    </div>
</asp:Content>
